This commit is contained in:
2017-02-28 23:40:13 +01:00
commit 7d7d46723d
10 changed files with 471 additions and 0 deletions

1
test/hi2.js Normal file
View File

@ -0,0 +1 @@
console.log('this is required from disk')

1
test/test.d.ts vendored Normal file
View File

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

21
test/test.js Normal file
View File

@ -0,0 +1,21 @@
"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==

24
test/test.ts Normal file
View File

@ -0,0 +1,24 @@
import 'typings-test'
import { expect } from 'smartchai'
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')
console.log('this console comment was injected')
`)
}
])
})
it('should log hi to console', function() {
require(path.join(__dirname, 'hi.js'))
})
})