Skip to content
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

try ts in mint #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ logs/*
*.log
test/*
node_modules
.idea/
.idea/*
minio-js/
7 changes: 7 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
spec: 'test/**/*.js',
exit: true,
reporter: 'spec',
ui: 'bdd',
require: ['dotenv/config', 'source-map-support/register', './babel-register.js'],
}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Run Tests:

ACCESS_KEY=minio SECRET_KEY=minio123 SERVER_ENDPOINT="localhost:22000" ./node_modules/mocha/bin/mocha -R minioreporter

# !!! Use this locally for testing

MINT_DATA_DIR=./data ACCESS_KEY=minio SECRET_KEY=minio123 SERVER_ENDPOINT="localhost:22000" ./node_modules/mocha/bin/mocha -R minioreporter


For latest release version specific testing:

./install.sh
Expand Down
28 changes: 28 additions & 0 deletions babel-register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// fix babel register doesn't transform TypeScript
//
// https://github.com/babel/babel/issues/8962#issuecomment-443135379

// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs
const register = require('@babel/register')

register({
extensions: ['.ts', '.js'],
assumptions: {
constantSuper: true,
noIncompleteNsImportDetection: true,
constantReexports: true,
},
plugins: [
[
'@babel/plugin-transform-modules-commonjs',
{
importInterop: 'node',
},
],
'@upleveled/remove-node-prefix', // lower version of node (<14) doesn't support require('node:fs')
],
presets: [
['@babel/preset-typescript', { allExtensions: true }],
['@babel/preset-env', { targets: { node: 'current' }, modules: 'cjs' }],
],
})
27 changes: 13 additions & 14 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
MINIO_JS_VERSION=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/minio-js/releases/latest | sed "s/https:\/\/github.com\/minio\/minio-js\/releases\/tag\///")
if [ -z "$MINIO_JS_VERSION" ]; then
echo "unable to get minio-js version from github"
exit 1
fi

echo "${MINIO_JS_VERSION}"

test_run_dir=""
rm -rf ./test
mkdir "./test"
wget "https://raw.githubusercontent.com/minio/minio-js/${MINIO_JS_VERSION}/src/test/functional/functional-tests.js" -O "test/functional-tests.js"
npm --prefix "$test_run_dir" install --save "minio@$MINIO_JS_VERSION"
npm --prefix "$test_run_dir" install

install_path="./minio-js/"
rm -rf $install_path

git clone https://github.com/minio/minio-js.git $install_path

cd $install_path || exit 0

LATEST="master" #$(git tag | tail -1)

git checkout "${LATEST}" --force

npm i
Loading