Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit fd1daac

Browse files
authored
Add npm scripts (#1765)
1 parent 15edbca commit fd1daac

File tree

5 files changed

+129
-3
lines changed

5 files changed

+129
-3
lines changed

.vscode/launch.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Tests-android",
6+
"type": "node",
7+
"request": "launch",
8+
"preLaunchTask": "Setup-tests-android",
9+
"runtimeExecutable": "npm",
10+
"runtimeArgs": [
11+
"run",
12+
"test:debugger:android"
13+
],
14+
"port": 9229,
15+
"stopOnEntry": false,
16+
"sourceMaps": true,
17+
"console": "internalConsole",
18+
"internalConsoleOptions": "openOnSessionStart",
19+
"autoAttachChildProcesses": true,
20+
"timeout": 100000
21+
},
22+
{
23+
"name": "Tests-ios",
24+
"type": "node",
25+
"request": "launch",
26+
"preLaunchTask": "Setup-tests-ios",
27+
"runtimeExecutable": "npm",
28+
"runtimeArgs": [
29+
"run",
30+
"test:debugger:ios"
31+
],
32+
"port": 9229,
33+
"stopOnEntry": false,
34+
"sourceMaps": true,
35+
"console": "internalConsole",
36+
"internalConsoleOptions": "openOnSessionStart",
37+
"autoAttachChildProcesses": true,
38+
"timeout": 100000
39+
}
40+
]
41+
}

.vscode/tasks.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"label": "Build",
7+
"command": "npm",
8+
"args": [
9+
"run",
10+
"build:tests"
11+
],
12+
"presentation": {
13+
"echo": false,
14+
"focus": false
15+
},
16+
"problemMatcher": [
17+
"$tsc"
18+
]
19+
},
20+
{
21+
"type": "shell",
22+
"label": "Setup-android",
23+
"command": "npm",
24+
"args": [
25+
"run",
26+
"test:setup:android"
27+
],
28+
"presentation": {
29+
"echo": false,
30+
"focus": false
31+
},
32+
"problemMatcher": [
33+
"$tsc"
34+
]
35+
},
36+
{
37+
"type": "shell",
38+
"label": "Setup-ios",
39+
"command": "npm",
40+
"args": [
41+
"run",
42+
"test:setup:ios"
43+
],
44+
"presentation": {
45+
"echo": false,
46+
"focus": false
47+
},
48+
"problemMatcher": [
49+
"$tsc"
50+
]
51+
},
52+
{
53+
"label": "Setup-tests-android",
54+
"dependsOn": [
55+
"Build",
56+
"Setup-android"
57+
]
58+
},
59+
{
60+
"label": "Setup-tests-ios",
61+
"dependsOn": [
62+
"Build",
63+
"Setup-ios"
64+
]
65+
}
66+
]
67+
}

code-push-plugin-testing-framework/script/testConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ var TEST_UPDATES_DIRECTORY_OPTION_NAME = "--updates-directory";
1313
var DEFAULT_UPDATES_DIRECTORY = path.join(os.tmpdir(), TestUtil_1.TestUtil.getPluginName(), "updates");
1414
var CORE_TESTS_ONLY_FLAG_NAME = "--core";
1515
var PULL_FROM_NPM_FLAG_NAME = "--npm";
16-
var DEFAULT_PLUGIN_PATH = path.join(__dirname, "../../..");
16+
var DEFAULT_PLUGIN_PATH = path.join(__dirname, "../..");
1717
var NPM_PLUGIN_PATH = TestUtil_1.TestUtil.getPluginName();
1818
var SETUP_FLAG_NAME = "--setup";
1919
var RESTART_EMULATORS_FLAG_NAME = "--clean";
2020
// CONST VARIABLES
2121
exports.TestAppName = "TestCodePush";
2222
exports.TestNamespace = "com.microsoft.codepush.test";
2323
exports.AcquisitionSDKPluginName = "code-push";
24-
exports.templatePath = path.join(__dirname, "../../../test/template");
24+
exports.templatePath = path.join(__dirname, "../../test/template");
2525
exports.thisPluginPath = TestUtil_1.TestUtil.readMochaCommandLineFlag(PULL_FROM_NPM_FLAG_NAME) ? NPM_PLUGIN_PATH : DEFAULT_PLUGIN_PATH;
2626
exports.testRunDirectory = TestUtil_1.TestUtil.readMochaCommandLineOption(TEST_RUN_DIRECTORY_OPTION_NAME, DEFAULT_TEST_RUN_DIRECTORY);
2727
exports.updatesDirectory = TestUtil_1.TestUtil.readMochaCommandLineOption(TEST_UPDATES_DIRECTORY_OPTION_NAME, DEFAULT_UPDATES_DIRECTORY);

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@
1212
],
1313
"author": "Microsoft Corporation",
1414
"license": "MIT",
15+
"scripts": {
16+
"clean": "shx rm -rf bin",
17+
"setup": "npm install --quiet --no-progress",
18+
"prebuild:tests": "npm run clean && npm run tslint",
19+
"build:tests": "tsc",
20+
"test": "npm run build:tests && npm run test:setup && npm run test:fast",
21+
"test:android": "npm run build:tests && npm run test:setup:android && npm run test:fast:android",
22+
"test:ios": "npm run build:tests && npm run test:setup:ios && npm run test:fast:ios",
23+
"test:setup": "mocha --recursive bin/test --android --ios --setup",
24+
"test:setup:android": "mocha --recursive bin/test --android --setup",
25+
"test:setup:ios": "mocha --recursive bin/test --ios --setup",
26+
"test:fast": "mocha --recursive bin/test --android --ios",
27+
"test:fast:android": "mocha --recursive bin/test --android",
28+
"test:fast:ios": "mocha --recursive bin/test --ios",
29+
"test:debugger:android": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --android",
30+
"test:debugger:ios": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --ios",
31+
"tslint": "tslint -c tslint.json test/**/*.ts"
32+
},
1533
"repository": {
1634
"type": "git",
1735
"url": "https://github.com/Microsoft/react-native-code-push"

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"noImplicitAny": true,
77
"noEmitOnError": true,
88
"moduleResolution": "node",
9-
"sourceMap": false,
9+
"sourceMap": true,
1010
"rootDir": "test",
1111
"outDir": "bin",
1212
"removeComments": true

0 commit comments

Comments
 (0)