Skip to content

Commit

Permalink
test: use toContain instead of simply true/false
Browse files Browse the repository at this point in the history
It will show up better in the logs if it doesnt match.
  • Loading branch information
hansl committed Mar 15, 2019
1 parent a1079d2 commit ba412d6
Showing 1 changed file with 10 additions and 5 deletions.
Expand Up @@ -8,6 +8,7 @@

import { Architect } from '@angular-devkit/architect/src/index2';
import { TestLogger } from '@angular-devkit/architect/testing';
import { logging } from '@angular-devkit/core';
import { browserBuild, createArchitect, host } from '../utils';


Expand Down Expand Up @@ -121,7 +122,12 @@ describe('Browser Builder scripts array', () => {
it('chunk in entry', async () => {
host.writeMultipleFiles(scripts);

const logger = new TestLogger('build-script-chunk-entry');
const logger = new logging.Logger('build-script-chunk-entry');
const logs: string[] = [];
logger.subscribe(({ message }) => {
logs.push(message);
});

await browserBuild(
architect,
host,
Expand All @@ -132,9 +138,8 @@ describe('Browser Builder scripts array', () => {
{ logger },
);

const validate = ` [entry] [rendered]`;
expect(logger.includes(`(lazy-script) 69 bytes${validate}`)).toBe(true);
expect(logger.includes(`(renamed-script) 78 bytes${validate}`)).toBe(true);
expect(logger.includes(`(renamed-lazy-script) 88 bytes${validate}`)).toBe(true);
expect(logs.join('\n')).toMatch(/\(lazy-script) 69 bytes .*\[entry] .*\[rendered]/);
expect(logs.join('\n')).toMatch(/\(renamed-script) 78 bytes .*\[entry] .*\[rendered]/);
expect(logs.join('\n')).toMatch(/\(renamed-lazy-script) 88 bytes .*\[entry] .*\[rendered]/);
});
});

0 comments on commit ba412d6

Please sign in to comment.