Skip to content

Commit

Permalink
[Tests] add implementation test; run es-shim-api in postlint; use…
Browse files Browse the repository at this point in the history
… `tape` runner
  • Loading branch information
ljharb committed Nov 26, 2020
1 parent ea2a273 commit 65667b7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
"pretest": "npm run lint",
"test": "npm run tests-only",
"posttest": "npx aud --production",
"tests-only": "es-shim-api --bound && npm run test:shimmed && npm run test:module",
"test:shimmed": "node test/shimmed",
"test:module": "node test/index",
"tests-only": "tape 'test/**/*.js'",
"coverage": "covert test/*.js",
"lint": "eslint ."
"lint": "eslint .",
"postlint": "es-shim-api --bound"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -52,6 +51,7 @@
"covert": "^1.1.1",
"eslint": "^7.0.0",
"functions-have-names": "^1.2.1",
"has-strict-mode": "^1.0.0",
"object-keys": "^1.1.1",
"safe-publish-latest": "^1.1.4",
"tape": "^5.0.0"
Expand Down
20 changes: 20 additions & 0 deletions test/implementation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var implementation = require('../implementation');
var callBind = require('es-abstract/helpers/callBind');
var test = require('tape');
var hasStrictMode = require('has-strict-mode')();
var runTests = require('./tests');

test('as a function', function (t) {
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
/* eslint no-useless-call: 0 */
st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
st.end();
});

runTests(callBind(implementation, Object), t);

t.end();
});

0 comments on commit 65667b7

Please sign in to comment.