-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bunch of fixes for solo test and solo param filtering, introduces mor…
…e stub test data to work with (mainly just looking at output right now - needs more asserts) and also better handling of params (deals with bright scripts loose json parser and invalid type, by having direct control of the suite, group and test via asText, as opposed to simply doing asJson and stringily)
- Loading branch information
George Cook
committed
Feb 6, 2019
1 parent
fea54bb
commit 26e1f09
Showing
173 changed files
with
29,323 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import * as chai from 'chai'; | ||
import * as fs from 'fs-extra'; | ||
import * as path from 'path'; | ||
|
||
import { expect } from 'chai'; | ||
|
||
import FunctionMap from './FunctionMap'; | ||
import { RuntimeConfig } from './RuntimeConfig'; | ||
|
||
const chaiSubset = require('chai-subset'); | ||
|
||
chai.use(chaiSubset); | ||
let runtimeConfig: RuntimeConfig; | ||
let sourcePathBunchOfFiles = 'src/test/stubProject'; | ||
let sourcePathOneFile = 'src/test/stubProjectOnlyTests_oneFile'; | ||
let sourcePathSoloTests = 'src/test/stubProjectOnlyTests'; | ||
let sourcePathSoloGroup = 'src/test/stubProjectOnlyItGroup'; | ||
let sourcePathSoloSuites = 'src/test/stubProjectOnlySuite'; | ||
let sourcePathNoSolos = 'src/test/stubProjectNoSolos'; | ||
let targetPath = 'build'; | ||
|
||
function clearFiles() { | ||
fs.removeSync(targetPath); | ||
} | ||
|
||
function copyFiles(sourcePath) { | ||
try { | ||
fs.copySync(sourcePath, targetPath); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
|
||
describe('RuntimeConfig tests ', function() { | ||
beforeEach(() => { | ||
let functionMap = new FunctionMap(); | ||
runtimeConfig = new RuntimeConfig(functionMap); | ||
}); | ||
|
||
describe('oneFile', function() { | ||
beforeEach(() => { | ||
clearFiles(); | ||
}); | ||
|
||
it('processes valid test file', () => { | ||
copyFiles(sourcePathOneFile); | ||
runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); | ||
let suites = runtimeConfig.testSuites; | ||
expect(suites).to.not.be.null; | ||
}); | ||
|
||
it('processes bunch of files', () => { | ||
copyFiles(sourcePathBunchOfFiles); | ||
runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); | ||
let suites = runtimeConfig.testSuites; | ||
expect(suites).to.not.be.null; | ||
}); | ||
|
||
it('processes files with solo suite', () => { | ||
copyFiles(sourcePathSoloSuites); | ||
runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); | ||
let suites = runtimeConfig.testSuites; | ||
expect(suites).to.not.be.null; | ||
}); | ||
|
||
it('processes files with solo group', () => { | ||
copyFiles(sourcePathSoloGroup); | ||
runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); | ||
let suites = runtimeConfig.testSuites; | ||
expect(suites).to.not.be.null; | ||
}); | ||
|
||
it('processes files with solo tests', () => { | ||
copyFiles(sourcePathSoloTests); | ||
runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); | ||
let suites = runtimeConfig.testSuites; | ||
expect(suites).to.not.be.null; | ||
}); | ||
|
||
it('processes files with no solo tests', () => { | ||
copyFiles(sourcePathNoSolos); | ||
runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); | ||
let suites = runtimeConfig.testSuites; | ||
expect(suites).to.not.be.null; | ||
let json = runtimeConfig.asJson(); //TODO test these return values | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.