Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(concatjs): update karma to 6.3.2 and fix #2093 #2603

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
"jest": "~25.3.0",
"jest-cli": "~25.3.0",
"jest-websocket-mock": "~2.0.2",
"karma": "~4.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-firefox-launcher": "1.1.0",
"karma-jasmine": "2.0.1",
"karma": "~6.3.2",
"karma-chrome-launcher": "3.1.0",
"karma-firefox-launcher": "2.1.0",
"karma-jasmine": "4.0.1",
"karma-requirejs": "1.1.0",
"karma-sourcemap-loader": "0.3.7",
"karma-sourcemap-loader": "0.3.8",
"lit-element": "^2.2.1",
"minimist": "^1.2.3",
"mock-socket": "~9.0.3",
Expand Down
5 changes: 4 additions & 1 deletion packages/concatjs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ ts_project(
"types": ["node"],
},
},
deps = ["@npm//@types/node"],
deps = [
"@npm//@types/node",
"@npm//karma",
],
)

js_library(
Expand Down
10 changes: 3 additions & 7 deletions packages/concatjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import * as crypto from 'crypto';
import * as fs from 'fs';
import * as File from 'karma/lib/file';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat hacky. We're probably not supposed to import from lib

import * as path from 'path';
import * as process from 'process';
import {createInterface} from 'readline';
Expand All @@ -29,13 +30,8 @@ function initConcatJs(logger, emitter, basePath, hostname, port) {
path.join(process.env['TEST_TMPDIR'], crypto.randomBytes(6).readUIntLE(0, 6).toString(36));

emitter.on('file_list_modified', files => {
const bundleFile = {
path: '/concatjs_bundle.js',
contentPath: tmpFile,
isUrl: false,
content: '',
encodings: {},
} as any;
const bundleFile = new File('/concatjs_bundle.js') as any;
bundleFile.contentPath = tmpFile;
// Preserve all non-JS that were there in the included list.
const included = files.included.filter(f => path.extname(f.originalPath) !== '.js');
const bundledFiles =
Expand Down
12 changes: 6 additions & 6 deletions packages/concatjs/web_test/test/stack_trace/test_sourcemap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
OUTPUT=$(${RUNFILES_DIR}/build_bazel_rules_nodejs/packages/concatjs/web_test/test/stack_trace/karma_test_chromium-local.sh)

# Test whether the package relative TS path is printed in stack trace.
echo ${OUTPUT} | grep -q "(packages/concatjs/web_test/test/stack_trace/failing.spec.ts:7:17"
echo ${OUTPUT} | grep -q "(packages/concatjs/web_test/test/stack_trace/failing.spec.ts:7:18"
if [[ "$?" != "0" ]]; then
echo "Did not find '(packages/concatjs/web_test/test/stack_trace/failing.spec.ts:7:17' in Karma stack trace"
echo "Did not find '(packages/concatjs/web_test/test/stack_trace/failing.spec.ts:7:18' in Karma stack trace"
echo $OUTPUT
exit 1
fi

# Test whether the package relative path inside a subdirectory is printed.
echo ${OUTPUT} | grep -q "(packages/concatjs/web_test/test/stack_trace/test_folder/test.spec.ts:5:23"
echo ${OUTPUT} | grep -q "(packages/concatjs/web_test/test/stack_trace/test_folder/test.spec.ts:5:24"
if [[ "$?" != "0" ]]; then
echo "Did not find '(packages/concatjs/web_test/test/stack_trace/test_folder/test.spec.ts:5:23' in Karma stack trace"
echo "Did not find '(packages/concatjs/web_test/test/stack_trace/test_folder/test.spec.ts:5:24' in Karma stack trace"
exit 1
fi

# Test whether stack trace with multiple stack frames mapped get printed.
echo ${OUTPUT} | grep -q "(packages/concatjs/web_test/test/stack_trace/test_folder/hello.ts:6:8"
echo ${OUTPUT} | grep -q "(packages/concatjs/web_test/test/stack_trace/test_folder/hello.ts:6:9"
if [[ "$?" != "0" ]]; then
echo "Did not find '(packages/concatjs/web_test/test/stack_trace/test_folder/hello.ts:6:8' in Karma stack trace"
echo "Did not find '(packages/concatjs/web_test/test/stack_trace/test_folder/hello.ts:6:9' in Karma stack trace"
exit 1
fi

Expand Down
Loading