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

Jest vs Bazel: Something is broken #5367

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions language-support/ts/jest_vs_bazel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
13 changes: 13 additions & 0 deletions language-support/ts/jest_vs_bazel/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//language-support/ts:jest.bzl", "jest_test")

jest_test(
name = "test",
srcs = ["index.test.js"],
jest_config = ":jest.config.js",
deps = [
"@language_support_ts_deps//jest-websocket-mock",
"@language_support_ts_deps//mock-socket",
],
)
9 changes: 9 additions & 0 deletions language-support/ts/jest_vs_bazel/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
const WS = require("jest-websocket-mock").default;
const Server = require("mock-socket").Server;

test("jest-websocket-mock", () => {
const ws = new WS("ws://localhost:1234");
expect(ws.server).toBeInstanceOf(Server);
});
13 changes: 13 additions & 0 deletions language-support/ts/jest_vs_bazel/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

module.exports = {
testEnvironment: "node",
testMatch: [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
],
transform: {
"^.+\\.(js|jsx)$": "babel-jest",
},
}
14 changes: 14 additions & 0 deletions language-support/ts/jest_vs_bazel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"private": true,
"name": "jest_vs_bazel",
"version": "0.0.1",
"license": "Apache-2.0",
"scripts": {
"test": "jest"
},
"devDependencies": {
"jest": "^24.9.0",
"jest-websocket-mock": "^2.0.2",
"mock-socket": "^9.0.3"
}
}
20 changes: 20 additions & 0 deletions language-support/ts/jest_vs_bazel/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"es2015"
],
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"outDir": "lib/",
"module": "commonjs",
"esModuleInterop": true,
"declaration": true,
"sourceMap": true,
"allowJs": true
},
"include": ["index.test.js"]
}
2 changes: 2 additions & 0 deletions language-support/ts/packages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"jest": "^24.9.0",
"jest-cli": "^24.9.0",
"jest-mock-console": "^1.0.0",
"jest-websocket-mock": "^2.0.2",
"mock-socket": "^9.0.3",
"ts-jest": "^24.3.0",
"typedoc": "^0.16.11"
}
Expand Down