fix(testing): support loading css

This commit is contained in:
Jason Jean 2019-03-05 16:21:35 -05:00 committed by Victor Savkin
parent 04c6966f25
commit 268fe36ab6
8 changed files with 40 additions and 11 deletions

View File

@ -28,14 +28,6 @@ Type: `string`
Dev server target to run tests against.
### headless
Default: `false`
Type: `boolean`
Whether or not to open the Cypress application to run the tests. If set to 'true', will run in headless mode
### exit
Default: `true`
@ -44,6 +36,14 @@ Type: `boolean`
Whether or not the Cypress Test Runner will stay open after running tests in a spec file
### headless
Default: `false`
Type: `boolean`
Whether or not to open the Cypress application to run the tests. If set to 'true', will run in headless mode
### record
Default: `false`

View File

@ -22,7 +22,7 @@ describe('Jest', () => {
const jestResult = await runCLIAsync(`test ${mylib}`);
expect(jestResult.stderr).toContain('Test Suites: 3 passed, 3 total');
done();
}, 10000);
}, 45000);
it('should be able to generate a testable application using jest', async () => {
ensureProject();
@ -35,5 +35,5 @@ describe('Jest', () => {
]);
const jestResult = await runCLIAsync(`test ${myapp}`);
expect(jestResult.stderr).toContain('Test Suites: 3 passed, 3 total');
}, 10000);
}, 450000);
});

View File

@ -23,6 +23,12 @@ describe('Web Applications', () => {
newLib(`${libName} --framework react`);
const mainPath = `apps/${appName}/src/main.tsx`;
updateFile(
`apps/${appName}/src/app/app.css`,
`body {
display: block;
}`
);
updateFile(mainPath, `import '@proj/${libName}';\n` + readFile(mainPath));
const lintResults = runCLI(`lint ${appName}`);

View File

@ -76,6 +76,7 @@ export function copyMissingPackages(): void {
'jest',
'@types/jest',
'jest-preset-angular',
'identity-obj-proxy',
'karma',
'karma-chrome-launcher',
'karma-coverage-istanbul-reporter',

View File

@ -74,6 +74,7 @@
"graphviz": "^0.0.8",
"html-webpack-plugin": "^3.2.0",
"husky": "^1.0.0-rc.13",
"identity-obj-proxy": "3.0.0",
"ignore": "^5.0.4",
"jasmine-core": "~2.99.1",
"jasmine-marbles": "0.4.0",

View File

@ -30,6 +30,7 @@
"@angular-devkit/build-webpack": "~0.13.1",
"copy-webpack-plugin": "4.6.0",
"fork-ts-checker-webpack-plugin": "0.4.9",
"identity-obj-proxy": "3.0.0",
"license-webpack-plugin": "^1.4.0",
"rxjs": "6.3.3",
"ts-loader": "5.3.1",

View File

@ -1,4 +1,4 @@
import { dirname } from 'path';
import { dirname, extname } from 'path';
import * as ts from 'typescript';
import defaultResolver from 'jest-resolve/build/defaultResolver';
@ -37,6 +37,16 @@ function getCompilerSetup(rootDir: string) {
let compilerSetup;
module.exports = function(path: string, options: ResolveOptions) {
const ext = extname(path);
if (
ext === '.css' ||
ext === '.scss' ||
ext === '.sass' ||
ext === '.less' ||
ext === '.styl'
) {
return require.resolve('identity-obj-proxy');
}
// Try to use the defaultResolver
try {
return defaultResolver(path, options);

View File

@ -5184,6 +5184,10 @@ har-validator@~5.1.0:
ajv "^5.3.0"
har-schema "^2.0.0"
harmony-reflect@^1.4.6:
version "1.6.1"
resolved "https://registry.yarnpkg.com/harmony-reflect/-/harmony-reflect-1.6.1.tgz#c108d4f2bb451efef7a37861fdbdae72c9bdefa9"
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
@ -5507,6 +5511,12 @@ iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, ic
dependencies:
safer-buffer ">= 2.1.2 < 3"
identity-obj-proxy@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14"
dependencies:
harmony-reflect "^1.4.6"
ieee754@^1.1.4:
version "1.1.12"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b"