Skip to content

Commit cc9420d

Browse files
authoredApr 12, 2021
chore: replace init scripts with a dependency on itself (#3674)
This has the same result (symlink to the `karma` in the node_modules), but has two benefits: - karma developers don't need to run extra command - no peer dependency warnings when `npm install` is run
1 parent d0fad69 commit cc9420d

File tree

6 files changed

+31
-39
lines changed

6 files changed

+31
-39
lines changed
 

‎.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ jobs:
66
include:
77
- node_js: "10"
88
script:
9-
- npm run init
109
- npm run test:unit
1110
- npm run test:e2e
1211

1312
- node_js: "12"
1413
script:
15-
- npm run init
1614
- npm run test:unit
1715
- npm run test:e2e
1816

1917
- node_js: "14"
2018
script:
21-
- npm run init
2219
- if [[ "$TRAVIS_BRANCH" != "master" ]]; then
2320
commitlint-travis;
2421
fi;

‎appveyor.yml

-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ install:
2020
# Install our package dependencies
2121
- appveyor-retry npm install
2222

23-
# Install our current directory as a dependency of itself
24-
- npm run init:windows
25-
2623
test_script:
2724
- npm run test:unit
2825
- npm run test:client

‎docs/dev/02-making-changes.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@ Here are some tips on how to set up a Karma workspace and how to send a good pul
2020
$ git clone https://github.com/<your-username>/karma.git
2121
$ cd karma
2222
```
23-
* Install for development. Use a recent npm version, ignore peerdep warnings
23+
* Install for development
2424
```bash
2525
$ npm install
26-
27-
$ npm run init
28-
# or if you're on Windows
29-
$ npm run init:windows
3026
```
3127

3228
## Testing and Building

‎package-lock.json

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@
460460
"http2": "^3.3.6",
461461
"husky": "^4.2.5",
462462
"jasmine-core": "^3.6.0",
463+
"karma": ".",
463464
"karma-browserify": "^7.0.0",
464465
"karma-browserstack-launcher": "^1.6.0",
465466
"karma-chai": "^0.1.0",
@@ -509,10 +510,6 @@
509510
"build:check": "node scripts/client.js check",
510511
"build:watch": "node scripts/client.js watch",
511512
"test:integration": "./scripts/integration-tests.sh",
512-
"link": "node --eval \"path=require('path'); require('fs').symlinkSync(path.resolve(__dirname), path.resolve(__dirname, 'node_modules', 'karma'), 'junction')\"",
513-
"unlink": "node --eval \"require('fs').unlinkSync(require('path').resolve(__dirname, 'node_modules', 'karma'))\"",
514-
"init": "rm -rf node_modules/karma && cd node_modules && ln -nsf ../ karma && cd ../",
515-
"init:windows": "(IF EXIST node_modules\\karma (rmdir node_modules\\karma /S /q)) && npm run link",
516513
"semantic-release": "semantic-release"
517514
}
518515
}

‎test/client/karma.conf.js

-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const fs = require('fs')
2-
31
const TRAVIS_WITH_BS = !!process.env.BROWSER_STACK_ACCESS_KEY
42

53
const launchers = {
@@ -37,28 +35,6 @@ const launchers = {
3735
}
3836
}
3937

40-
// Verify the install. This will run async but that's ok we'll see the log.
41-
fs.lstat('node_modules/karma', (err, stats) => {
42-
if (err) {
43-
console.error('Cannot verify installation', err.stack || err)
44-
}
45-
if (stats && stats.isSymbolicLink()) {
46-
return
47-
}
48-
49-
console.log('**** Incorrect directory layout for karma self-tests ****')
50-
console.log(`
51-
$ npm install
52-
53-
$ npm run init
54-
# or if you're on Windows
55-
$ npm run init:windows
56-
57-
$ npm run build
58-
`)
59-
process.exit(1)
60-
})
61-
6238
let browsers = ['Chrome']
6339

6440
if (process.env.TRAVIS) {

0 commit comments

Comments
 (0)
Please sign in to comment.