Skip to content

Commit

Permalink
Unflag t.like() assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Jul 27, 2020
1 parent bc39bcc commit fac7990
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 43 deletions.
24 changes: 0 additions & 24 deletions docs/03-assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,30 +215,6 @@ Instead AVA derives a *comparable* object from `value`, based on the deeply-nest

Any values in `selector` that are not regular objects should be deeply equal to the corresponding values in `value`.

This is an experimental assertion for the time being. You need to enable it:

**`package.json`**:

```json
{
"ava": {
"nonSemVerExperiments": {
"likeAssertion": true
}
}
}
```

**`ava.config.js`**:

```js
export default {
nonSemVerExperiments: {
likeAssertion: true
}
}
```

In the following example, the `map` property of `value` must be deeply equal to that of `selector`. However `nested.qux` is ignored, because it's not in `selector`.

```js
Expand Down
9 changes: 0 additions & 9 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,6 @@ class Assertions {
});

this.like = withSkip((actual, selector, message) => {
if (!experiments.likeAssertion) {
fail(new AssertionError({
assertion: 'like',
improperUsage: true,
message: 'You must enable the `likeAssertion` experiment in order to use `t.like()`'
}));
return;
}

if (!checkMessage('like', message)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/load-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const pkgConf = require('pkg-conf');

const NO_SUCH_FILE = Symbol('no ava.config.js file');
const MISSING_DEFAULT_EXPORT = Symbol('missing default export');
const EXPERIMENTS = new Set(['disableSnapshotsInHooks', 'likeAssertion', 'reverseTeardowns']);
const EXPERIMENTS = new Set(['disableSnapshotsInHooks', 'reverseTeardowns']);

// *Very* rudimentary support for loading ava.config.js files containing an `export default` statement.
const evaluateJsConfig = configFile => {
Expand Down
4 changes: 1 addition & 3 deletions test-tap/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ const assertions = new class extends assert.Assertions {
lastFailure = error;
},
skip: () => {},
experiments: {
likeAssertion: true
},
experiments: {},
...overwrites
});
}
Expand Down
2 changes: 1 addition & 1 deletion test-tap/helper/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const run = (type, reporter, {match = [], filter} = {}) => {
serial: type === 'failFast' || type === 'failFast2',
require: [],
cacheEnabled: true,
experiments: {likeAssertion: true},
experiments: {},
match,
providers,
projectDir,
Expand Down
2 changes: 1 addition & 1 deletion test-tap/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ test('log from tests', t => {

test('assertions are bound', t => {
// This does not test .fail() and .snapshot(). It'll suffice.
return withExperiments({likeAssertion: true})(a => {
return ava(a => {
(a.plan)(14);
(a.pass)();
(a.is)(1, 1);
Expand Down
5 changes: 1 addition & 4 deletions test/assertions/fixtures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
"ava": {
"files": [
"*.js"
],
"nonSemVerExperiments": {
"likeAssertion": true
}
]
}
}

0 comments on commit fac7990

Please sign in to comment.