Skip to content

Commit

Permalink
fix: SDK builds incorrectly since release 3.5.0 causing various bugs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dblythy authored Nov 7, 2022
1 parent a52c4c6 commit f15154f
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 10 deletions.
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const watch = require('gulp-watch');
const BUILD = process.env.PARSE_BUILD || 'browser';
const VERSION = require('./package.json').version;

const transformRuntime = ["@babel/plugin-transform-runtime", {
const transformRuntime = ["@babel/transform-runtime", {
"corejs": 3,
"helpers": true,
"regenerator": true,
Expand All @@ -22,10 +22,10 @@ const transformRuntime = ["@babel/plugin-transform-runtime", {
const PRESETS = {
'browser': [["@babel/preset-env", {
"targets": "> 0.25%, not dead"
}], '@babel/preset-react'],
}]],
'weapp': [["@babel/preset-env", {
"targets": "> 0.25%, not dead"
}], '@babel/preset-react'],
}], '@babel/react'],
'node': [["@babel/preset-env", {
"targets": { "node": "8" }
}]],
Expand Down
31 changes: 31 additions & 0 deletions integration/test/ParseDistTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const puppeteer = require('puppeteer');
let page = null;
for (const fileName of ['parse.js', 'parse.min.js']) {
beforeAll(async () => {
const browser = await puppeteer.launch();
page = await browser.newPage();
await page.goto(`http://localhost:1337/${fileName}`);
});
describe(`Parse Dist Test ${fileName}`, () => {
it('can save an object', async () => {
const response = await page.evaluate(async () => {
const object = await new Parse.Object('TestObject').save();
return object.id;
});
expect(response).toBeDefined();
const obj = await new Parse.Query('TestObject').first();
expect(obj).toBeDefined();
expect(obj.id).toEqual(response);
});
it('can query an object', async () => {
const obj = await new Parse.Object('TestObject').save();
const response = await page.evaluate(async () => {
const object = await new Parse.Query('TestObject').first();
return object.id;
});
expect(response).toBeDefined();
expect(obj).toBeDefined();
expect(obj.id).toEqual(response);
});
});
}
23 changes: 23 additions & 0 deletions integration/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const CustomAuth = require('./CustomAuth');
const sleep = require('./sleep');
const { TestUtils } = require('parse-server');
const Parse = require('../../node');
const fs = require('fs');
const path = require('path');

const port = 1337;
const mountPath = '/parse';
Expand Down Expand Up @@ -115,6 +117,27 @@ const reconfigureServer = (changedConfiguration = {}) => {
});
parseServer = ParseServer.start(newConfiguration);
const app = parseServer.expressApp;
for (const fileName of ['parse.js', 'parse.min.js']) {
const file = fs
.readFileSync(path.resolve(__dirname, `./../../dist/${fileName}`))
.toString();
app.get(`/${fileName}`, (req, res) => {
res.send(`<html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Parse Functionality Test</title>
<script>${file}</script>
<script>
(function() {
Parse.initialize('integration');
Parse.serverURL = 'http://localhost:1337/parse';
})();
</script>
</head>
<body>
</body></html>`);
});
}
app.get('/clear/:fast', (req, res) => {
const { fast } = req.params;
TestUtils.destroyAllDataPermanently(fast).then(() => {
Expand Down
Loading

0 comments on commit f15154f

Please sign in to comment.