-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f73214d
commit c6b4c05
Showing
11 changed files
with
22,684 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,4 +86,4 @@ describe('createShortcut', () => { | |
'Shortcuts not supported on your system' | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const tfSetup = require('../../Launch-Scripts/tfSetup') | ||
const os = require('os') | ||
|
||
jest.mock('os', () => { | ||
return { | ||
platform: jest.fn(() => 'win32') | ||
} | ||
}) | ||
|
||
jest.mock('fs', () => { | ||
return { | ||
copyFile: jest.fn(() => 'true'), | ||
existsSync: jest.fn(() => true), | ||
readdirSync: jest.fn(() => { | ||
return { | ||
filter: jest.fn((dirent) => { | ||
return { | ||
map: jest.fn((dirent) => 'dirname') | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
|
||
afterEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
|
||
describe('tfSetup', () => { | ||
it('should copy tensorflow.dll for windows sytems', () => { | ||
expect(tfSetup()).toEqual('tensorflow dll copied') | ||
}) | ||
it('should do nothing if not windows system', () => { | ||
jest.spyOn(os, 'platform').mockReturnValue('linux') | ||
expect(tfSetup()).toEqual('non-windows system') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const fs = require('fs') | ||
const os = require('os') | ||
const path = require('path') | ||
|
||
const tfSetup = () => { | ||
const srcFolder = './node_modules/@tensorflow/tfjs-node/deps/lib/' | ||
const destFolder = './node_modules/@tensorflow/tfjs-node/lib/' | ||
|
||
if (os.platform() === 'win32' && fs.existsSync(srcFolder) && fs.existsSync(destFolder)) { | ||
const dest = fs.readdirSync(destFolder, { withFileTypes: true }) | ||
.filter(dirent => dirent.isDirectory()) | ||
.map(dirent => dirent.name) | ||
|
||
|
||
fs.copyFile(path.join(srcFolder, "tensorflow.dll"), path.join(destFolder, dest[0], "tensorflow.dll"), (err) => { | ||
if (err) { | ||
console.log(err) | ||
return err | ||
} | ||
console.log('tensorflow dll copied') | ||
}) | ||
return 'tensorflow dll copied' | ||
} | ||
return 'non-windows system' | ||
} | ||
|
||
module.exports = tfSetup |
Oops, something went wrong.