diff options
Diffstat (limited to 'tests/specs/npm/es_module')
-rw-r--r-- | tests/specs/npm/es_module/__test__.json | 22 | ||||
-rw-r--r-- | tests/specs/npm/es_module/bundle.out | 1 | ||||
-rw-r--r-- | tests/specs/npm/es_module/main.js | 9 | ||||
-rw-r--r-- | tests/specs/npm/es_module/main.out | 3 | ||||
-rw-r--r-- | tests/specs/npm/es_module/test.js | 5 | ||||
-rw-r--r-- | tests/specs/npm/es_module/test.out | 11 |
6 files changed, 51 insertions, 0 deletions
diff --git a/tests/specs/npm/es_module/__test__.json b/tests/specs/npm/es_module/__test__.json new file mode 100644 index 000000000..f720a2bc0 --- /dev/null +++ b/tests/specs/npm/es_module/__test__.json @@ -0,0 +1,22 @@ +{ + "base": "npm", + "steps": [{ + "args": "run --allow-read --allow-env main.js", + "output": "main.out" + }, { + "cleanDenoDir": true, + "args": "test --allow-read --allow-env test.js", + "output": "test.out" + }, { + "cleanDenoDir": true, + "args": [ + "eval", + "import chalk from 'npm:chalk@5'; console.log(chalk.green('chalk esm loads'));" + ], + "output": "main.out" + }, { + "args": "bundle --quiet main.js", + "output": "bundle.out", + "exitCode": 1 + }] +} diff --git a/tests/specs/npm/es_module/bundle.out b/tests/specs/npm/es_module/bundle.out new file mode 100644 index 000000000..c749a236a --- /dev/null +++ b/tests/specs/npm/es_module/bundle.out @@ -0,0 +1 @@ +error: npm specifiers have not yet been implemented for this subcommand (https://github.com/denoland/deno/issues/15960). Found: npm:/chalk@5.0.1 diff --git a/tests/specs/npm/es_module/main.js b/tests/specs/npm/es_module/main.js new file mode 100644 index 000000000..0f1fa2590 --- /dev/null +++ b/tests/specs/npm/es_module/main.js @@ -0,0 +1,9 @@ +import chalk from "npm:chalk@5"; + +if (import.meta.main) { + console.log(chalk.green("chalk esm loads")); +} + +export function test(value) { + return chalk.red(value); +} diff --git a/tests/specs/npm/es_module/main.out b/tests/specs/npm/es_module/main.out new file mode 100644 index 000000000..2010a5b73 --- /dev/null +++ b/tests/specs/npm/es_module/main.out @@ -0,0 +1,3 @@ +Download http://localhost:4545/npm/registry/chalk +Download http://localhost:4545/npm/registry/chalk/chalk-5.0.1.tgz +chalk esm loads diff --git a/tests/specs/npm/es_module/test.js b/tests/specs/npm/es_module/test.js new file mode 100644 index 000000000..b9c91c715 --- /dev/null +++ b/tests/specs/npm/es_module/test.js @@ -0,0 +1,5 @@ +import { test } from "./main.js"; + +Deno.test("test", () => { + console.log(test("test")); +}); diff --git a/tests/specs/npm/es_module/test.out b/tests/specs/npm/es_module/test.out new file mode 100644 index 000000000..0ed0fbd3c --- /dev/null +++ b/tests/specs/npm/es_module/test.out @@ -0,0 +1,11 @@ +Download http://localhost:4545/npm/registry/chalk +Download http://localhost:4545/npm/registry/chalk/chalk-5.0.1.tgz +running 1 test from ./test.js +test ... +------- output ------- +test +----- output end ----- +test ... ok ([WILDCARD]s) + +ok | 1 passed | 0 failed ([WILDCARD]s) + |