Skip to content

Commit

Permalink
Using jest projects config to run tests (#135)
Browse files Browse the repository at this point in the history
* upgrading jest to support global setup on multi-projects;
jestjs/jest#6865

updating deprecated property

remove tsconfig.jest.json

ignore d.ts files form coverage

* fix e2e root dir path
  • Loading branch information
devaradhanm committed Feb 6, 2019
1 parent 51b3e5c commit 0e24d72
Show file tree
Hide file tree
Showing 20 changed files with 10,957 additions and 15,276 deletions.
15 changes: 0 additions & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,6 @@
"internalConsoleOptions": "neverOpen",
"port": 9229
},
{
"name": "Debug current E2E test file in VSCode",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/jest/bin/jest.js",
"--runInBand",
"--config=${workspaceRoot}/jest.e2e.config.js",
"${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"port": 9229
},
{
"name": "Attach debugger to DetailsView in running Chrome instance (must launch Chrome with --remote-debugging-port=9230)",
"type": "chrome",
Expand Down
16 changes: 0 additions & 16 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,6 @@
"panel": "dedicated"
}
},
{
"label": "E2E test current file in VSCode",
"command": "node",
"args": [
"${workspaceRoot}/node_modules/jest/bin/jest.js",
"--runInBand",
"--config=${workspaceRoot}/jest.e2e.config.js",
"${relativeFile}"
],
"group": "test",
"type": "shell",
"presentation": {
"reveal": "always",
"panel": "dedicated"
}
},
{
"label": "Begin Jest watch session",
"command": "node",
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ We use [jest](https://github.com/facebook/jest) as our test framework and [puppe
To run a task from the command palette, press **Ctrl + Shift + P**, select `Tasks: Run Task`, and select the task you want to run:

- `npm: test` runs all unit tests
- `Test current file in VSCode` runs just the unit tests in the currently-opened file
- `Test current file in VSCode` runs just the tests in the currently-opened test file
- `npm: test:e2e` runs all end-to-end tests
- `E2E test current file in VSCode` runs just the end-to-end tests in the currently-opened file

To debug inside VS Code, set a breakpoint and click the debug button or press **F5**. Note that there are 2 debug targets (one for unit tests and one for end-to-end tests); be sure to use the appropriate one for the test you are debugging.
To debug inside VS Code, set a breakpoint and click the debug button or press **F5**.

To debug using an external tool, run the `Debug current test file outside VS Code` task. In Chrome, for example, navigate to `chrome://inspect` and click `Open dedicated DevTools for Node`.

Expand Down
4 changes: 2 additions & 2 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- task: Npm@1
inputs:
command: custom
customCommand: run test-in-ci
customCommand: run test -- --ci
displayName: run unit tests

- task: PublishTestResults@2
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- task: Npm@1
inputs:
command: custom
customCommand: run test-in-ci:e2e
customCommand: run test:e2e -- --ci
displayName: run e2e tests

- task: PublishTestResults@2
Expand Down
13 changes: 1 addition & 12 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
var common = require('./jest.common.config');

module.exports = {
...common,
coverageDirectory: './test-results/unit/coverage',
setupFiles: ['<rootDir>/src/tests/unit/jest-setup.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js'],
roots: ['<rootDir>/src/tests/unit'],
collectCoverage: true,
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}', '!<rootDir>/src/tests/**'],
coverageReporters: ['json', 'lcov', 'text', 'cobertura'],
testEnvironment: 'jsdom',
reporters: ['default', ['jest-junit', { outputDirectory: '.', outputName: './test-results/unit/junit.xml' }]],
projects: ['<rootDir>/src/tests/unit', '<rootDir>/src/tests/end-to-end'],
};
18 changes: 0 additions & 18 deletions jest.e2e.config.js

This file was deleted.

0 comments on commit 0e24d72

Please sign in to comment.