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
ljharb committed Nov 26, 2020
1 parent 49c35e9 commit 4e47830
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -10,15 +10,14 @@
"main": "index.js",
"scripts": {
"prepublish": "safe-publish-latest",
"pretest": "npm run --silent lint && es-shim-api --bound",
"pretest": "npm run --silent lint",
"test": "npm run --silent tests-only",
"posttest": "npx aud --production",
"tests-only": "npm run --silent test:shimmed && npm run --silent test:module",
"test:shimmed": "node test/shimmed",
"test:module": "node test",
"tests-only": "tape 'test/**/*.js'",
"coverage": "covert test/*.js",
"coverage:quiet": "covert test/*.js --quiet",
"lint": "eslint ."
"lint": "eslint .",
"postlint": "es-shim-api --bound"
},
"repository": {
"type": "git",
@@ -46,6 +45,7 @@
"covert": "^1.1.1",
"eslint": "^7.8.1",
"functions-have-names": "^1.2.1",
"has-strict-mode": "^1.0.0",
"safe-publish-latest": "^1.1.4",
"tape": "^5.0.1"
},
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 4e47830

Please sign in to comment.