Skip to content

Commit 7bc323e

Browse files
committed
cover the unminified option for the test.spec.js. Share the expectations between describes.
1 parent c613914 commit 7bc323e

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

test/specs/tasks/test.spec.js

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,40 +52,34 @@ describe('The Angularity test task', function () {
5252
.addInvocation('test')
5353
.forEach(slowIt(expectations))
5454
.finally(done);
55-
56-
function expectations(testCase) {
57-
expect(testCase.stdout).toBeTask('test');
58-
expect(testCase.stdout).toMatch(/INFO\s\[karma\]/); // TODO @bholloway choose a browser that will work on cloud CI
59-
javascriptTask.expectations(testCase);
60-
61-
// make replacements to allow karma.conf.js to be correctly diff'd
62-
var workingTestFile = helper.getConcatenation(testCase.cwd, TEST_FOLDER);
63-
var sourceTestFile = helper.getConcatenation(testCase.sourceDir, TEST_FOLDER);
64-
var replace = helper.replacer()
65-
.add(/^(\s*basePath\:\s*['"])[^'"]*(['"].*)$/gm, '$1%redacted%$2') // basePath should be redacted
66-
.add(/^(\s*require\(['"])[^'"]*(['"].*)$/gm, '$1%redacted%$2') // all require paths should be redacted
67-
.add(/\\{2}/g, '/')
68-
.commit();
69-
expect(replace(workingTestFile('karma.conf.js'))).diffPatch(replace(sourceTestFile('karma.conf.js')));
70-
}
7155
});
7256

73-
describe('should not support unminified option', function(done) {
57+
describe('should support unminified option, but not minify test output', function(done) {
7458
helper.runner.create()
7559
.addSource('minimal-es5-unminified')
7660
.addInvocation('test --unminified')
7761
.addInvocation('test -u')
7862
.forEach(slowIt(expectations))
7963
.finally(done);
80-
81-
function expectations(testCase) {
82-
if (!testCase.exitcode) { // TODO @bholloway windows invocation fails in test but not in real use
83-
expect(testCase.stderr).toBeHelpWithError(true);
84-
}
85-
}
8664
});
8765
});
8866

67+
function expectations(testCase) {
68+
expect(testCase.stdout).toBeTask('test');
69+
expect(testCase.stdout).toMatch(/INFO\s\[karma\]/); // TODO @bholloway choose a browser that will work on cloud CI
70+
javascriptTask.expectations(testCase);
71+
72+
// make replacements to allow karma.conf.js to be correctly diff'd
73+
var workingTestFile = helper.getConcatenation(testCase.cwd, TEST_FOLDER);
74+
var sourceTestFile = helper.getConcatenation(testCase.sourceDir, TEST_FOLDER);
75+
var replace = helper.replacer()
76+
.add(/^(\s*basePath\:\s*['"])[^'"]*(['"].*)$/gm, '$1%redacted%$2') // basePath should be redacted
77+
.add(/^(\s*require\(['"])[^'"]*(['"].*)$/gm, '$1%redacted%$2') // all require paths should be redacted
78+
.add(/\\{2}/g, '/')
79+
.commit();
80+
expect(replace(workingTestFile('karma.conf.js'))).diffPatch(replace(sourceTestFile('karma.conf.js')));
81+
}
82+
8983
function customMatchers() {
9084
jasmine.addMatchers({
9185
toBeHelpWithError: matchers.getHelpMatcher(/^\s*The "test" task/)

0 commit comments

Comments
 (0)