This commit is contained in:
2017-07-28 18:19:06 +02:00
parent eb0d9b6f56
commit d6e66fdfb9
7 changed files with 236 additions and 61 deletions

1
test/test.d.ts vendored
View File

@ -1 +0,0 @@
import 'typings-test';

View File

@ -1,21 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-test");
const path = require("path");
const smartinject = require("../dist/index");
describe('smartinject', function () {
it('should inject a file using fileArray', function () {
return smartinject.injectFileArray([
{
path: path.join(__dirname, 'hi.js'),
contents: new Buffer(`require('./hi2.js')
console.log('this console comment was injected')
`)
}
]);
});
it('should log hi to console', function () {
require(path.join(__dirname, 'hi.js'));
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx3QkFBcUI7QUFHckIsNkJBQTRCO0FBRTVCLDZDQUE0QztBQUU1QyxRQUFRLENBQUMsYUFBYSxFQUFFO0lBQ3BCLEVBQUUsQ0FBQyxzQ0FBc0MsRUFBRTtRQUN2QyxNQUFNLENBQUMsV0FBVyxDQUFDLGVBQWUsQ0FBQztZQUMvQjtnQkFDSSxJQUFJLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsT0FBTyxDQUFDO2dCQUNuQyxRQUFRLEVBQUUsSUFBSSxNQUFNLENBQ3BDOztDQUVDLENBQUM7YUFDVztTQUNKLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0lBRUYsRUFBRSxDQUFDLDBCQUEwQixFQUFFO1FBQzNCLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFBO0lBQzFDLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

View File

@ -1,24 +1,23 @@
import 'typings-test'
import { expect } from 'smartchai'
import { tap, expect } from 'tapbundle'
import * as path from 'path'
import * as smartinject from '../dist/index'
describe('smartinject', function() {
it('should inject a file using fileArray', function() {
return smartinject.injectFileArray([
{
path: path.join(__dirname, 'hi.js'),
contents: new Buffer(
`require('./hi2.js')
tap.test('should inject a file using fileArray', async () => {
return smartinject.injectFileArray([
{
path: path.join(__dirname, 'hi.js'),
contents: new Buffer(
`require('./hi2.js')
console.log('this console comment was injected')
`)
}
])
})
`)
}
])
})
it('should log hi to console', function() {
require(path.join(__dirname, 'hi.js'))
})
})
tap.test('should log hi to console', async () => {
require(path.join(__dirname, 'hi.js'))
})
tap.start()