-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from mongodb-js/export-fn-to-js
feat: compile functions to js
- Loading branch information
Showing
7 changed files
with
70 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Run Tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
check-and-test: | ||
name: Check and Test | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.4.0 | ||
|
||
- name: Install NPM Packages | ||
run: npm ci | ||
|
||
- name: Check and Test | ||
run: | | ||
npm run check | ||
npm run compile | ||
npm run test |
This file was deleted.
Oops, something went wrong.
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
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
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,29 @@ | ||
const bsonTranspilers = require('..'); | ||
const assert = require('assert'); | ||
|
||
const { | ||
BsonTranspilersUnimplementedError | ||
} = require('../helper/error'); | ||
|
||
describe('function expressions (shell)', () => { | ||
it('compiles functions to javascript', () => { | ||
assert.strictEqual( | ||
bsonTranspilers.shell.javascript.compile('function(){}'), | ||
'function(){}' | ||
); | ||
}); | ||
|
||
['object', 'csharp', 'java', 'python'].forEach((language) => { | ||
it(`throws an unsupported error compiling functions to ${language}`, () => { | ||
assert.throws( | ||
() => { | ||
bsonTranspilers.shell[language].compile('function(){}'); | ||
}, | ||
new BsonTranspilersUnimplementedError( | ||
'Support for exporting functions to languages other than javascript is not yet available.' | ||
) | ||
); | ||
}); | ||
}); | ||
}); | ||
|