Skip to content

Commit 98e308a

Browse files
committed
Move tests next to implementation
1 parent 71130a9 commit 98e308a

File tree

6 files changed

+26
-12
lines changed

6 files changed

+26
-12
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ const fs = require('fs');
44
const path = require('path');
55
const $ = require('child_process');
66
const { assert, refute, match, sinon } = require('@sinonjs/referee-sinon');
7-
const footer = require('../lib/footer');
8-
const changes = require('..');
7+
const footer = require('./footer');
8+
const changes = require('./changes');
99

10-
describe('changes', () => {
10+
describe('lib/changes', () => {
1111
beforeEach(() => {
1212
sinon.stub(fs, 'readFileSync');
1313
sinon.stub(fs, 'writeFileSync');
File renamed without changes.
File renamed without changes.
File renamed without changes.

package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
},
88
"main": "lib/changes.js",
99
"scripts": {
10-
"lint": "eslint . && prettier --check .",
11-
"test": "mocha",
12-
"watch": "mocha --watch",
13-
"posttest": "npm run lint",
14-
"preversion": "npm test",
10+
"lint": "eslint .",
11+
"test": "mocha '**/*.test.js'",
12+
"watch": "npm test -- --watch",
13+
"preversion": "npm run lint && npm run prettier:check && npm test",
1514
"version": "bin/cmd.js -c --footer",
1615
"postversion": "git push --follow-tags && npm publish",
1716
"prettier:check": "prettier --check '**/*.{js,json,md}'",
@@ -38,6 +37,11 @@
3837
"no-template-curly-in-string": 0
3938
}
4039
},
40+
"mocha": {
41+
"require": "test/hooks.js",
42+
"ignore": "node_modules/**",
43+
"reporter": "dot"
44+
},
4145
"dependencies": {
4246
"@studio/editor": "^1.1.1",
4347
"@studio/json-request": "^3.0.1",
@@ -59,10 +63,11 @@
5963
"url": "https://github.com/javascript-studio/studio-changes.git"
6064
},
6165
"files": [
62-
"bin",
63-
"lib",
64-
"LICENSE",
65-
"README.md"
66+
"CHANGES.md",
67+
"**/*.js",
68+
"!**/*.test.js",
69+
"!test/**",
70+
"!.*"
6671
],
6772
"license": "MIT",
6873
"lint-staged": {

test/hooks.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
const { sinon } = require('@sinonjs/referee-sinon');
4+
5+
exports.mochaHooks = {
6+
afterEach() {
7+
sinon.restore();
8+
}
9+
};

0 commit comments

Comments
 (0)