From fab02f1fcc9d1a5de7b9f7d4a2a0bedf1bc9c522 Mon Sep 17 00:00:00 2001 From: Fabian Wiles Date: Thu, 27 Jan 2022 22:43:47 +0000 Subject: [PATCH] feat(jasmine): add basic ESM support --- packages/jasmine/jasmine_runner.js | 2 +- packages/jasmine/test/esm/BUILD.bazel | 7 +++++++ packages/jasmine/test/esm/jasmine_import.spec.mjs | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/jasmine/test/esm/BUILD.bazel create mode 100644 packages/jasmine/test/esm/jasmine_import.spec.mjs diff --git a/packages/jasmine/jasmine_runner.js b/packages/jasmine/jasmine_runner.js index 6fbbd657d6..8f357a709c 100644 --- a/packages/jasmine/jasmine_runner.js +++ b/packages/jasmine/jasmine_runner.js @@ -50,7 +50,7 @@ if (TOTAL_SHARDS) { // the maximum (See: https://nodejs.org/api/errors.html#errors_error_stacktracelimit) Error.stackTraceLimit = Infinity; -const IS_TEST_FILE = /[^a-zA-Z0-9](spec|test)\.js$/i; +const IS_TEST_FILE = /[^a-zA-Z0-9](spec|test)\.(mjs|js)$/i; const IS_NODE_MODULE = /\/node_modules\// // We process arguments by splicing them out of the process.argv diff --git a/packages/jasmine/test/esm/BUILD.bazel b/packages/jasmine/test/esm/BUILD.bazel new file mode 100644 index 0000000000..3534159465 --- /dev/null +++ b/packages/jasmine/test/esm/BUILD.bazel @@ -0,0 +1,7 @@ +load("//packages/jasmine:index.bzl", "jasmine_node_test") + + +jasmine_node_test( + name = "jasmine_import", + srcs = ["jasmine_import.spec.mjs"], +) \ No newline at end of file diff --git a/packages/jasmine/test/esm/jasmine_import.spec.mjs b/packages/jasmine/test/esm/jasmine_import.spec.mjs new file mode 100644 index 0000000000..068b77d2a6 --- /dev/null +++ b/packages/jasmine/test/esm/jasmine_import.spec.mjs @@ -0,0 +1,6 @@ + +describe('spec in file ending with *.mjs', () => { + it('should run', () => { + expect(true).toBe(true); + }); +});