Skip to content

Commit

Permalink
fix: update angular schematic test and scripts. (#16466)
Browse files Browse the repository at this point in the history
* fix: merge commit

* fix: remove jasmine. add mocha/chai. remove builder test for now. update tsconfig. update package json with main folder. remove package yarn.lock in favor of monorepo

* fix: restore filenames

* fix: add eslint ignore for compiled files

* fix: move eslintignore to root. add circle commands for schematic.

* fix: add master to releaserc. update test build scripts. update schematic test.
  • Loading branch information
admah committed May 12, 2021
1 parent cac3685 commit 3351aea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions npm/cypress-schematic/.releaserc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
...require('../../.releaserc.base'),
branches: [
{ name: 'master', channel: 'latest' },
{ name: 'next/npm/cypress-schematic', channel: 'next', prerelease: 'alpha' },
],
}
3 changes: 2 additions & 1 deletion npm/cypress-schematic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"launch:test": "yarn link:sandbox && cd sandbox && ng add @cypress/schematic --removeProtractor=false && cd ..",
"link:sandbox": "yarn link && cd sandbox && yarn link @cypress/schematic",
"test:all": "yarn build:all && yarn test:schematics && yarn launch:test && yarn test:builders",
"test:schematics": "mocha src/schematics/cypress/*_spec.js",
"test:builders": "mocha -r @packages/ts/register --reporter mocha-multi-reporters --reporter-options configFile=../../mocha-reporter-config.json src/builders/cypress/index_spec.ts",
"test:schematics": "mocha -r @packages/ts/register --reporter mocha-multi-reporters --reporter-options configFile=../../mocha-reporter-config.json src/schematics/cypress/index_spec.ts",
"test:e2e:sandbox": "cd sandbox && ng run sandbox:cypress-run",
"unlink:sandbox": "cd sandbox && yarn unlink @cypress/schematic && cd .. && yarn unlink"
},
Expand Down
14 changes: 6 additions & 8 deletions npm/cypress-schematic/src/schematics/cypress/index_spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'
import { join } from 'path'
import { join, resolve } from 'path'
import { expect } from 'chai'

// const NUMBER_OF_SCAFFOLDED_FILES = 36;

describe('@cypress/schematic: ng-add', () => {
const schematicRunner = new SchematicTestRunner(
'schematics',
Expand Down Expand Up @@ -33,14 +31,14 @@ describe('@cypress/schematic: ng-add', () => {
})

it('should create cypress files', async () => {
const files = ['integration/spec.ts', 'plugins/index.js', 'support/commands.ts', 'support/index.ts', 'tsconfig.json', 'cypress.json']
const homePath = '/projects/sandbox/cypress/'
const files = ['cypress/integration/spec.ts', 'cypress/plugins/index.js', 'cypress/support/commands.ts', 'cypress/support/index.ts', 'cypress/tsconfig.json', 'cypress.json']
const homePath = '/projects/sandbox/'

schematicRunner.runSchematicAsync('ng-add', {}, appTree).toPromise().then((tree) => {
return schematicRunner.runSchematicAsync('ng-add', {}, appTree).toPromise().then((tree) => {
files.forEach((f) => {
const path = `${homePath}${f}`
const pathToFile = resolve(homePath, f)

expect(tree.exists(path)).equal(true)
expect(tree.exists(pathToFile), pathToFile).equal(true)
})
})
})
Expand Down

0 comments on commit 3351aea

Please sign in to comment.