-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc09072
commit 00b93fa
Showing
7 changed files
with
76 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
{ | ||
"schematics": {} | ||
"schematics": { | ||
"update-8.1.0": { | ||
"version": "8.1.0", | ||
"description": "Update cypress", | ||
"factory": "./src/migrations/update-8-1-0/update-8-1-0" | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/cypress/src/migrations/update-8-1-0/update-8-1-0.spec.ts
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,34 @@ | ||
import { Tree } from '@angular-devkit/schematics'; | ||
import { SchematicTestRunner } from '@angular-devkit/schematics/testing'; | ||
import { serializeJson } from '@nrwl/workspace'; | ||
|
||
import * as path from 'path'; | ||
|
||
describe('Update 8.1.0', () => { | ||
let initialTree: Tree; | ||
let schematicRunner: SchematicTestRunner; | ||
|
||
beforeEach(() => { | ||
initialTree = Tree.empty(); | ||
initialTree.create( | ||
'package.json', | ||
serializeJson({ | ||
scripts: {} | ||
}) | ||
); | ||
schematicRunner = new SchematicTestRunner( | ||
'@nrwl/cypress', | ||
path.join(__dirname, '../../../migrations.json') | ||
); | ||
}); | ||
|
||
it('should update cypress', async () => { | ||
const result = await schematicRunner | ||
.runSchematicAsync('update-8.1.0', {}, initialTree) | ||
.toPromise(); | ||
|
||
const { devDependencies } = JSON.parse(result.readContent('package.json')); | ||
|
||
expect(devDependencies.cypress).toEqual('~3.3.1'); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
packages/cypress/src/migrations/update-8-1-0/update-8-1-0.ts
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,33 @@ | ||
import { | ||
Rule, | ||
chain, | ||
SchematicContext, | ||
Tree | ||
} from '@angular-devkit/schematics'; | ||
import { updateJsonInTree } from '@nrwl/workspace'; | ||
import { stripIndents } from '@angular-devkit/core/src/utils/literals'; | ||
|
||
function displayInformation(host: Tree, context: SchematicContext) { | ||
context.logger.info( | ||
stripIndents`Cypress has been updated to a version that improves network speed by 300%! | ||
Additionally, this resolves an issue where '@types/jquery' needed to be temporarily included in your 'package.json'. | ||
If you're not using '@types/jquery' in your project otherwise, you may now remove it from your 'devDependencies'.` | ||
); | ||
} | ||
|
||
export default function(): Rule { | ||
return chain([ | ||
updateJsonInTree('package.json', json => { | ||
json.devDependencies = json.devDependencies || {}; | ||
|
||
json.devDependencies = { | ||
...json.devDependencies, | ||
cypress: '~3.3.1' | ||
}; | ||
|
||
return json; | ||
}), | ||
displayInformation | ||
]); | ||
} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const nxVersion = '*'; | ||
export const cypressVersion = '3.1.0'; | ||
export const cypressVersion = '~3.3.1'; |