Skip to content

Commit cd30e40

Browse files
committed
initial set - up
1 parent 88a9a1d commit cd30e40

7 files changed

Lines changed: 80 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ package-lock.json
44
ex.js
55
spa-report
66
.idea
7+
playground.js

lib/mochaProgrammatically.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
с

lol.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,37 @@
1-
console.info('!!!!')
1+
const Mocha = require('mocha'),
2+
fs = require('fs'),
3+
path = require('path');
4+
5+
const {getSpecFilesArr} = require('./rerun')
6+
7+
// Instantiate a Mocha instance.
8+
var mocha = new Mocha();
9+
10+
const itSpecNameRegex = /(?<=it\(')(\d|\w|\s)+/ig
11+
12+
13+
14+
var testDir = path.relative(__dirname, './mocha_specs')
15+
16+
// Add each .js file to the mocha instance
17+
getSpecFilesArr(testDir)
18+
19+
20+
.forEach(function(file) {
21+
22+
const fileContent = fs.readFileSync(file, {encoding: 'utf8'})
23+
24+
console.log(fileContent.match(itSpecNameRegex))
25+
26+
// mocha.addFile(
27+
// path.join(testDir, file)
28+
// );
29+
});
30+
31+
32+
33+
34+
// // Run the tests.
35+
// mocha.run(function(failures) {
36+
// process.exitCode = failures ? 1 : 0; // exit with non-zero status if there were failures
37+
// });

mocha_specs/1.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const {expect} = require('chai')
2+
3+
describe('First describe', () => {
4+
it('it 1 first describe ', () => {
5+
expect(1).to.eql(1)
6+
})
7+
it('it 2 first describe ', () => {
8+
expect(1).to.eql(2)
9+
})
10+
it('it 3 first describe ', () => {
11+
expect(1).to.eql(3)
12+
})
13+
})
14+

mocha_specs/2.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const {expect} = require('chai')
2+
3+
describe('Second describe', () => {
4+
it('it 1 second describe ', () => {
5+
expect(1).to.eql(1)
6+
})
7+
it('it 2 second describe ', () => {
8+
expect(1).to.eql(2)
9+
})
10+
it('it 3 second describe ', () => {
11+
expect(1).to.eql(3)
12+
})
13+
})

mocha_specs/3.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const {expect} = require('chai')
2+
3+
describe('Third describe', () => {
4+
it('it 1 third describe ', () => {
5+
expect(1).to.eql(1)
6+
})
7+
it('it 2 third describe ', () => {
8+
expect(1).to.eql(2)
9+
})
10+
it('it 3 third describe ', () => {
11+
expect(1).to.eql(3)
12+
})
13+
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "process-rerun",
3-
"version": "0.0.14",
3+
"version": "0.0.15",
44
"bin": {
55
"protractor-rerun": "./bin/rerun"
66
},

0 commit comments

Comments
 (0)