Skip to content

fix: SDK builds incorrectly since release 3.5.0 causing various bugs #1600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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