Skip to content

Commit eceb67e

Browse files
authored
Merge pull request #370 from microsoftgraph/code-coverage
Unit tests restructuring
2 parents 524572e + 4c4ee32 commit eceb67e

File tree

77 files changed

+5292
-983
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5292
-983
lines changed

.gitignore

+3-8
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,11 @@ npm-debug.log
1414
/lib/*
1515
!/lib/.npmignore
1616

17-
src/**/*.js
18-
src/**/*.js.map
19-
src/**/*.d.ts
20-
2117
samples/node/secrets.json
2218
samples/browser/src/secrets.js
2319
samples/browser/src/graph-js-sdk.js
2420
samples/browser/src/graph-es-sdk.js
2521

26-
spec/**/*.js
27-
spec/**/*.d.ts
28-
spec/**/*.js.map
29-
spec/**/secrets.ts
22+
test/development/secrets.ts
23+
24+
.nyc_output/*

.prettierignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ src/**/*.js
66
src/**/*.js.map
77
src/**/*.d.ts
88

9-
spec/**/*.js
10-
spec/**/*.js.map
11-
spec/**/*.d.ts
9+
test/**/*.js
10+
test/**/*.js.map
11+
test/**/*.d.ts

.vscode/launch.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"request": "launch",
1919
"name": "Run Content tests",
2020
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
21-
"args": ["${workspaceRoot}/lib/spec/content/*.js"],
21+
"args": ["${workspaceRoot}/lib/test/common/**/*.js"],
2222
"cwd": "${workspaceRoot}",
2323
"preLaunchTask": "Run Compile",
2424
"outFiles": [],
@@ -29,7 +29,7 @@
2929
"request": "launch",
3030
"name": "Run Core tests",
3131
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
32-
"args": ["${workspaceRoot}/lib/spec/core/*.js"],
32+
"args": ["${workspaceRoot}/lib/test/common/core/*.js"],
3333
"cwd": "${workspaceRoot}",
3434
"preLaunchTask": "Run Compile",
3535
"outFiles": [],
@@ -40,7 +40,7 @@
4040
"request": "launch",
4141
"name": "Run Middleware tests",
4242
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
43-
"args": ["${workspaceRoot}/lib/spec/middleware/*.js"],
43+
"args": ["${workspaceRoot}/lib/test/common/middleware/*.js"],
4444
"cwd": "${workspaceRoot}",
4545
"preLaunchTask": "Run Compile",
4646
"outFiles": [],
@@ -51,7 +51,7 @@
5151
"request": "launch",
5252
"name": "Run Tasks tests",
5353
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
54-
"args": ["${workspaceRoot}/lib/spec/tasks/*.js"],
54+
"args": ["${workspaceRoot}/lib/test/common/tasks/*.js"],
5555
"cwd": "${workspaceRoot}",
5656
"preLaunchTask": "Run Compile",
5757
"outFiles": [],
@@ -62,7 +62,7 @@
6262
"request": "launch",
6363
"name": "Run Workload tests",
6464
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
65-
"args": ["${workspaceRoot}/spec/development/workload/*.js"],
65+
"args": ["${workspaceRoot}/test/common/development/workload/*.js"],
6666
"cwd": "${workspaceRoot}",
6767
"preLaunchTask": "Run Compile",
6868
"outFiles": [],

CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ npm install
114114

115115
To edit files, open them in an editor of your choice and modify them. To create a new file, use the editor of your choice and save the new file in the appropriate location in your local copy of the repository. While working, save your work frequently.
116116

117-
*Note: Make sure to add unit tests to validate you changes.*
117+
_Note: Make sure to add unit tests to validate you changes._
118118

119-
Once you have done with your changes, You have to build and test your changes
120-
To build the library run,
119+
Build and test your changes with the following commands after you have completed your work:
121120

122121
```cmd
123122
npm run build

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Refer devDependencies in [package.json](./package.json) for the compatible msal
6868
```
6969

7070
```typescript
71-
7271
// Configuration options for MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options
7372
const msalConfig = {
7473
auth: {
@@ -97,7 +96,7 @@ npm install msal@<version>
9796
import { UserAgentApplication } from "msal";
9897

9998
import { ImplicitMSALAuthenticationProvider } from "@microsoft/microsoft-graph-client/lib/src/ImplicitMSALAuthenticationProvider";
100-
import { MSALAuthenticationProviderOptions } from '@microsoft/microsoft-graph-client/lib/src/MSALAuthenticationProviderOptions';
99+
import { MSALAuthenticationProviderOptions } from "@microsoft/microsoft-graph-client/lib/src/MSALAuthenticationProviderOptions";
101100

102101
// An Optional options for initializing the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics#configuration-options
103102
const msalConfig = {

karma.conf.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = function(config) {
2+
config.set({
3+
frameworks: ["mocha", "chai", "karma-typescript"],
4+
files: ["test/common/**/*.ts", "src/**/*.ts", "test/browser/**/*.ts", "test/*.ts"],
5+
preprocessors: {
6+
"**/*.ts": ["karma-typescript"],
7+
},
8+
karmaTypescriptConfig: {
9+
tsconfig: "./tsconfig-cjs.json",
10+
},
11+
browsers: ["ChromeHeadless"],
12+
});
13+
};

lib/.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.npmignore
2-
spec/
2+
test/

0 commit comments

Comments
 (0)