!151 更新配置以便运行jest和wallaby

Merge pull request !151 from ChenX/jest
pull/151/MERGE
ChenX 6 years ago
parent d982c0f8e4
commit b4d441409b

@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`路径简化 1`] = `
Array [
Vector2 {
"x": 0,
"y": 0,
},
Vector2 {
"x": 10,
"y": 0,
},
Vector2 {
"x": 18,
"y": 6,
},
Vector2 {
"x": 28.3,
"y": 6,
},
]
`;

@ -9,6 +9,5 @@ test('盒子相减', () =>
let b2 = new Box3Ext(new Vector3(200, 0, 0), new Vector3(205, 10, 300));
let bs = b.substract(b2, 0);
expect(bs.length).toBe(0);
expect(bs.length).toBe(1);
});

@ -85,7 +85,7 @@
},
"jest": {
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
".(ts|tsx)": "ts-jest"
},
"testRegex": "(/__test__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": [

@ -1,5 +1,6 @@
import { ArraybufferUtils } from "./binary/ArraybufferUtils";
import { Base64Utils } from './binary/Base64Utils';
import { BufferUtils } from "./binary/BufferUtils";
/**
* FileSystem is used to read and write files using nunuStudio.

@ -1,6 +1,3 @@
"use strict";
/**
* ArraybufferUtils contains methods to convert from and to ArrayBuffer binary format
*

@ -1,30 +0,0 @@
"use strict";
/**
* BufferUtils contains methods to convert from and to Node.js Buffer binary format
*
* @class BufferUtils
* @module BinaryUtils
* @static
*/
function BufferUtils(){}
/**
* Create nodejs buffer from arraybuffer
*
* @method fromArrayBuffer
* @param {Arraybuffer} array
* @return {Buffer} buffer
*/
BufferUtils.fromArrayBuffer = function(array)
{
var buffer = new Buffer(array.byteLength);
var view = new Uint8Array(array);
for(var i = 0; i < buffer.length; i++)
{
buffer[i] = view[i];
}
return buffer;
};

@ -0,0 +1,30 @@
/**
* BufferUtils contains methods to convert from and to Node.js Buffer binary format
*
* @class BufferUtils
* @module BinaryUtils
* @static
*/
export class BufferUtils
{
/**
* Create nodejs buffer from arraybuffer
*
* @method fromArrayBuffer
* @param {Arraybuffer} array
* @return {Buffer} buffer
*/
static fromArrayBuffer = array =>
{
const buffer = new Buffer(array.byteLength);
const view = new Uint8Array(array);
for (let i = 0; i < buffer.length; i++)
{
buffer[i] = view[i];
}
return buffer;
};
}

@ -2,7 +2,6 @@
"compilerOptions": {
"sourceMap": true,
"module": "commonjs",
"allowJs": true,
"target": "esnext",
"noLib": false,
"moduleResolution": "node",
@ -14,13 +13,13 @@
"types": [
"node",
"webpack-env",
"webpack-dev-server"
"webpack-dev-server",
"jest"
],
"jsx": "react",
"experimentalDecorators": true
},
"include": [
"./src/**/*",
"./config/**/*",
]
}

Loading…
Cancel
Save