Skip to content

Commit

Permalink
Merge pull request #48 from igor-dv/v8
Browse files Browse the repository at this point in the history
release v8
  • Loading branch information
igor-dv authored Mar 5, 2023
2 parents e0af18d + 106b40f commit 1024336
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 40 deletions.
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

27 changes: 0 additions & 27 deletions .circleci/config.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ci

on: push

jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install
run: yarn install
- name: Lint
run: yarn lint
- name: Test
run: yarn test
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env'],
};
9 changes: 9 additions & 0 deletions example/specific.snapshot.old-format.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '../src/index';

test('test object serialization format', () => {
const object = {
array: [{ hello: 'Danger' }],
};

expect(object).toMatchSpecificSnapshot('./specific/strings/strings-old-format.shot');
});
8 changes: 8 additions & 0 deletions example/specific.snapshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ test('with custom serializer', () => {
test('with extended matcher', () => {
expect(11).toMatchExtendedSpecificSnapshot('./specific/extended_matcher/test1.shot');
});

test('test object serialization format', () => {
const object = {
array: [{ hello: 'Danger' }],
};

expect(object).toMatchSpecificSnapshot('./specific/strings/strings.shot');
});
11 changes: 11 additions & 0 deletions example/specific/strings/strings-old-format.shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`test object serialization format 1`] = `
Object {
"array": Array [
Object {
"hello": "Danger",
},
],
}
`;
11 changes: 11 additions & 0 deletions example/specific/strings/strings.shot
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`test object serialization format 1`] = `
{
"array": [
{
"hello": "Danger",
},
],
}
`;
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
cacheDirectory: './.jest/cache',
};
7 changes: 7 additions & 0 deletions jest.old-format.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
cacheDirectory: './.jest/cache',
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
};
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "jest-specific-snapshot",
"version": "7.0.0",
"version": "8.0.0",
"license": "MIT",
"repository": "https://github.com/igor-dv/jest-specific-snapshot",
"main": "dist/index.js",
"scripts": {
"test": "jest specific.snapshot.test",
"test:default": "jest specific.snapshot.test",
"test:old": "jest specific.snapshot.old-format.test --config jest.old-format.config.js",
"test": "npm run test:default && npm run test:old",
"babel": "babel src -d dist",
"lint": "eslint .",
"lint-fix": "npm run lint -- --fix",
"prepare": "npm run babel"
},
"jest": {
"cacheDirectory": "./.jest/cache"
},
"dependencies": {
"jest-snapshot": "^29.0.0"
},
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function toMatchSpecificSnapshot(received, snapshotFile, ...rest) {
snapshotState = new SnapshotState(absoluteSnapshotFile, {
updateSnapshot: commonSnapshotState._updateSnapshot,
snapshotPath: absoluteSnapshotFile,
snapshotFormat: commonSnapshotState.snapshotFormat,
});
snapshotsStateMap.set(absoluteSnapshotFile, snapshotState);
}
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1661,9 +1661,9 @@ camelcase@^6.2.0:
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==

caniuse-lite@^1.0.30001219:
version "1.0.30001246"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001246.tgz"
integrity sha512-Tc+ff0Co/nFNbLOrziBXmMVtpt9S2c2Y+Z9Nk9Khj09J+0zR9ejvIW5qkZAErCbOrVODCx/MN+GpB5FNBs5GFA==
version "1.0.30001460"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001460.tgz"
integrity sha512-Bud7abqjvEjipUkpLs4D7gR0l8hBYBHoa+tGtKJHvT2AYzLp1z7EmVkUT4ERpVUfca8S2HGIVs883D8pUH1ZzQ==

chalk@^2.0.0, chalk@^2.1.0:
version "2.4.2"
Expand Down

0 comments on commit 1024336

Please sign in to comment.