Skip to content

Commit

Permalink
test(builtin): add test for issue 1813
Browse files Browse the repository at this point in the history
Issue bazel-contrib#1813 was fixed by bazel-contrib#1800 which is already landed. bazel-contrib#1805 also fixes via a different mechanism and will also land soon.
  • Loading branch information
gregmagolan committed Apr 9, 2020
1 parent 5c2f6c1 commit 1a57d57
Show file tree
Hide file tree
Showing 5 changed files with 1,825 additions and 10 deletions.
18 changes: 18 additions & 0 deletions internal/linker/test/issue_1813/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("@npm//jest-cli:index.bzl", "jest_test")

jest_test(
name = "test",
args = [
"--config",
"$(rootpath jest.config.js)",
"--runTestsByPath",
"$(rootpath index.test.js)",
],
data = [
"index.test.js",
"jest.config.js",
"@npm//jest",
"@npm//jest-websocket-mock",
"@npm//mock-socket",
],
)
14 changes: 14 additions & 0 deletions internal/linker/test/issue_1813/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Loaded from common-js format
// node_modules/jest-websocket-mock/lib/jest-websocket-mock.cjs.js
const WS = require('jest-websocket-mock').default;
// Loaded from js format
// node_modules/mock-socket/dist/mock-socket.js"
const Server = require('mock-socket').Server;

test('jest-websocket-mock', () => {
const ws = new WS('ws://localhost:1234');
console.log(ws.server.constructor); // [Function: Server] { of: [Function: of] }
console.log(Server); // [Function: Server] { of: [Function: of] }
expect(ws.server).toBeInstanceOf(Server); // Fails without node-patches symlink guards fix in
// https://github.com/bazelbuild/rules_nodejs/pull/1800
});
Empty file.
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"jasmine": "~3.4.0",
"jasmine-core": "~3.4.0",
"jasmine-reporters": "~2.3.2",
"jest": "~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",
Expand All @@ -51,6 +53,7 @@
"karma-sourcemap-loader": "0.3.7",
"lit-element": "^2.2.1",
"minimist": "^1.2.2",
"mock-socket": "~9.0.3",
"node_resolve_index": "file:./tools/npm_packages/node_resolve_index",
"node_resolve_index_2": "file:./tools/npm_packages/node_resolve_index_2",
"node_resolve_index_3": "file:./tools/npm_packages/node_resolve_index_3",
Expand Down Expand Up @@ -86,6 +89,10 @@
"yarn": "1.22.0",
"zone.js": "0.8.29"
},
"// resolutions/**/jest-serializer": "need to resolve to a version that doesn't have a /// <reference path='../v8.d.ts' /> in build/index.d.ts which exposes a bug in ts_library",
"resolutions": {
"**/jest-serializer": "24.3.0"
},
"scripts": {
"test": "bazelisk test --test_tag_filters=-e2e,-examples,-manual,-browser:firefox-local",
"test_windows": "bazelisk test --test_tag_filters=-e2e,-examples,-fix-windows,-manual,-browser:firefox-local",
Expand Down
Loading

0 comments on commit 1a57d57

Please sign in to comment.